home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 32
/
Amiga Format AFCD32 (Nov 1998, Issue 117).iso
/
-seriously_amiga-
/
programming
/
other
/
classfree
/
cfbuttonclass
/
cfbutton.doc
next >
Wrap
Text File
|
1998-08-10
|
4KB
|
136 lines
Class: CFbuttonclass
Author: Anders E. Andersen <andersa@fys.ku.dk>
Superclass: gadgetclass
Desciption: GadTools button gadget replacement
Include File: "CDbutton.h"
New Methods:
------------
None
Changed Methods:
----------------
GM_HITTEST - Allways returns GMR_GADGETHIT
GM_GOACTIVE - Sets gadget flag GFLG_SELECTED, renders
gadget and returns GMR_MEACTIVE.
GM_HANDLEINPUT - Handles gadget rendering according to
mouse movements, checks for gadget abort in two ways,
MENUDOWN and SELECTUP with mousepointer outside gadget.
Also checks for GACT_RELVERIFY to see if IDCMP_GADGETUP
should be sent. It clears GFLG_SELECTED when mouse is
outside the select box and sets it again if the mouse
reenters the select box.
As long as GFLG_SELECTED is set the object sends itself
OM_NOTIFY messages for every IECLASS_TIMER event that
GM_HANDLEINPUT gets. For all these messages the
OPUF_INTERIM flag is set in opu_Flags and the GA_ID
attribute is in opu_AttrList.
GM_GOINACTIVE - If GFLG_SELECTED is set, it clears it,
renders the gadget and sends itself an OM_NOTIFY message
with OPUF_INTERIM cleared and the GA_ID attribute in
opu_AttrList.
Attributes:
-----------
All attributes are passed directly to gadgetclass. The
following attributes are used by CFbuttonclass:
GA_Left, GA_Top, GA_Width, GA_Height
Positions and sizes the button.
GA_Text
NULL terminated C string. See CFBU_Layout for display control.
GA_Image
Excepts a plain Intuition or custom (BOOPSI) image object as
data value. It is sent to the superclass, which means the value
is stored in Gadget.GadgetRender.
Positioning depends on the CFBU_Layout attribute.
GA_RelVerify
Determines if IDCMP_GADGETUP messages should be sent.
GA_Border
Boolean. If TRUE, 3D button edges are drawn. If FALSE,
the drawing pass is skipped entirely (no fill!).
GA_Image and GA_Text still works though.
Defaults to TRUE. Overrides the gadgetclass definition.
GA_Highlight
Boolean. If TRUE, the gadget internals are complemented
when selected. Actually it is filled with FILLPEN. If FALSE,
the gadget is just drawn as being down.
If GA_Border is set to false, this attribute is ignored.
Defaults to TRUE. Overrides the gadgetclass definition.
CFBU_Layout
Takes various flags as the data argument. With this attribute
it is possible to have easy control over image and text
positioning in the button.
The flags are:
LAYOUT_AUTO - No flags set. Text is centered and image
is positioned via its own LeftEdge and
TopEdge attributes (IA_Left and IA_Top).
LAYOUT_TXTLEFT -
LAYOUT_TXTRIGHT - Left/right justifies the button text.
LAYOUT_IMGABOVE - This will change the images LeftEdge and
TopEdge values (IA_Left and IA_Top) to
position the image in the top-center of the
button.
If a text label is given, it is automatically
positioned at the bottom of the button.
LAYOUT_IMGBELOW - This flag works just opposide of
LAYOUT_IMGABOVE and is overrided if that
flag is set.
LAYOUT_IMGLEFT -
LAYOUT_IMGRIGHT - Together with LAYOUT_IMGABOVE or
LAYOUT_IMGBELOW these flags move the image
to the far left or right instead of centering
them. The image is still positioned in the top
or buttom of the gadget.
If LAYOUT_IMGABOVE or LAYOUT_IMGBELOW is not
set the the image is left or right justified
but centered in the button. This will also
position the text in the empty space to the
right of the image if LAYOUT_IMGLEFT is set
and to the left of the image if
LAYOUT_IMGRIGHT is set. The text can still be
left or right justified or it can remain
centered in this space. An example of how this
works can be seen in the CFpumbutton.gadget.
The triangle image is given via GA_Image, and
CFBU_Layout has LAYOUT_IMGLEFT|LAYOUT_TXTLEFT
set.